<link rel="stylesheet" href="/Content/FileUpload/css/jquery.fileupload.css" />
<script language="JavaScript" type="text/javascript" src="/Content/My97DatePicker/WdatePicker.js"></script>
<link rel="stylesheet" href="/Content/kindeditor/themes/default/default.css" />
<script charset="utf-8" src="/Content/kindeditor/kindeditor-min.js"></script>
<script charset="utf-8" src="/Content/kindeditor/lang/zh-CN.js"></script>
<script src="/Content/layer/layer.js"></script>

<style>
#allmap {width: 100%;height: 100%;overflow: hidden;margin:0;font-family:"微软雅黑";}

</style>
<div class="col-lg-12">
                    <div class="ibox float-e-margins">
                        <div class="ibox-title">
                            <h5>
							<if condition="$info.id == 0">添加网络电视
    <else />修改网络电视
</if>
							</h5>
                            
                        </div>
                        <div class="ibox-content">
                            <form  action="/index.php/Home/Index/addtv" id="myform" method="post" class="form-horizontal"  enctype="multipart/form-data">
                               
								
								<div class="form-group"><label class="col-sm-2 control-label">名称</label>
                                    <div class="col-sm-10">
									<input type="text"  class="form-control"  name="name" value="{$info.name}" />
									</div>
                                </div>
									<div class="form-group"><label class="col-sm-2 control-label">类型</label>
                                    <div class="col-sm-10">
										<select class="form-control m-b" name="typeid">
										<if condition="($info.typeid eq '1')"> 
									<option value="1" selected="selected">会议直播</option>
									<option value="2">网络电视</option>
									<elseif condition="($info.typeid eq '2')" /> 
									<option value="1" >会议直播</option>
									<option value="2" selected="selected">网络电视</option>
									<else /> 
									<option value="1" >会议直播</option>
									<option value="2" >网络电视</option>
								</if>
									
								
								
													
											</volist>
											</select>
									</div>
                                </div>
									<div class="form-group"><label class="col-sm-2 control-label">LOGO标题</label>
                                    <div class="col-sm-10">
									<input type="text" class="form-control"   name="logotitle" value="{$info.logotitle}">
									</div>
                                </div>
								<div class="form-group"><label class="col-sm-2 control-label">LOGO图片</label>
											  <div class="col-sm-10">
										<span class="btn btn-success fileinput-button">
											<i class="glyphicon glyphicon-plus"></i>
											<span>添加图片</span>
											
										  <input id="fileupload" type="file" name="imgFile" multiple>
											
										</span>
										<span>{$chicun}</span>
										<div id="showpic">
										  <if condition="($info.logoimg neq '')"> 
										<img src="/{$info.logoimg}" id="imglogo"  width="100px"/>
										<a class="dellogo">删除图片</a>
											<else /> 
												
											</if>
										</div>
									</div>
                                </div>
								<div class="form-group"><label class="col-sm-2 control-label">无信号图片</label>
											  <div class="col-sm-10">
										<span class="btn btn-success fileinput-button">
											<i class="glyphicon glyphicon-plus"></i>
											<span>添加图片</span>
											
										  <input id="fileupload2" type="file" name="imgFile" multiple>
											
										</span>
										
										<div id="showpic2">
										  <if condition="($info.nosignalimg neq '')"> 
										<img src="/{$info.nosignalimg}" id="showimg"  width="100px"/>
										<a class="delimg">删除图片</a>
											<else /> 
												
											</if>
										</div>
									</div>
                                </div>
									<div class="form-group"><label class="col-sm-2 control-label">无信号文字提示</label>
                                    <div class="col-sm-10">
									<input type="text" class="form-control"   name="desc" value="{$info.desc}">
									</div>
                                </div>
							<div class="form-group"><label class="col-sm-2 control-label">网络地址(多个用逗号分隔)</label>
                                    <div class="col-sm-10">
									<input type="text" class="form-control"   id="url" name="url" value="{$info.url}">
									<button class="btn btn-primary choosevideo" type="button" >选择视频</button>
									</div>
                                </div>
								
								
									<div class="form-group"><label class="col-sm-2 control-label">排序</label>
                                    <div class="col-sm-10">
									<input type="text" class="form-control"   name="seq" value="{$info.seq}">
									</div>
                                </div>
							
								
                                <div class="form-group">
                                    <div class="col-sm-4 col-sm-offset-2">
                                        <button class="btn btn-primary" type="submit" >保存</button>
                                    </div>
                                </div>
								<input type="hidden" value="{$info.id}" name="id" />
								<input type="hidden" value="{$info.logoimg}" name="logoimg" id="imgurl" />
								<input type="hidden" value="{$info.nosignalimg}" name="nosignalimg" id="imgurl2" />
                            </form>
                        </div>
                    </div>
                </div>
	
<script src="/Content/FileUpload/js/vendor/jquery.ui.widget.js"></script>
<script src="/Content/FileUpload/js/jquery.iframe-transport.js"></script>
<script src="/Content/FileUpload/js/jquery.fileupload.js"></script>
<script>
 $(function () {
                'use strict';
                var url = "/upload.php";
                $('#fileupload').fileupload({
                    autoUpload: true,//是否自动上传
                    url: url,
                    dataType: 'json',
                    done: function (e, data) {
                       
                        console.log(data.result);
                        if (data.result.error == 1) {
                            swal("上传出错了!", data.result.message, "success");
                        } else {
                            var pic = data.result.pic;
                            $("#showpic").html("<img src='/" + pic + "' width='100px'/>");
                            $("#imgurl").val(pic);


                        }
                    },
                    progressall: function (e, data) {
                        var progress = parseInt(data.loaded / data.total * 100, 10);
                        $('#progress .progress-bar').css(
                            'width',
                            progress + '%'
                        );
                    }
                }).prop('disabled', !$.support.fileInput)
                    .parent().addClass($.support.fileInput ? undefined : 'disabled');
					
				$('#fileupload2').fileupload({
                    autoUpload: true,//是否自动上传
                    url: url,
                    dataType: 'json',
                    done: function (e, data) {
                       
                        console.log(data.result);
                        if (data.result.error == 1) {
                            swal("上传出错了!", data.result.message, "success");
                        } else {
                            var pic = data.result.pic;
                            $("#showpic2").html("<img src='/" + pic + "' width='100px'/>");
                            $("#imgurl2").val(pic);


                        }
                    },
                    progressall: function (e, data) {
                        var progress = parseInt(data.loaded / data.total * 100, 10);
                        $('#progress .progress-bar').css(
                            'width',
                            progress + '%'
                        );
                    }
                }).prop('disabled', !$.support.fileInput)
                    .parent().addClass($.support.fileInput ? undefined : 'disabled');
					
});

$(".choosevideo").click(function(){
	layer.open({
		  type: 2,
		  title: '选择视频',
		  shadeClose: true,
		  shade: 0.8,
		  area: ['730px', '80%'],
		  content: '/index.php/Home/Index/choosevideo'
		}); 
});
function loadurl(url){
	$("#url").val(url);
}
$(".delimg").click(function(){
			$("#imgurl2").val("");
			$("#showimg").remove();
});

$(".dellogo").click(function(){
			$("#imgurl").val("");
			$("#imglogo").remove();
});
</script>